package user

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"net/http"
	"goo/middleware/db"
	"goo/model/user"
)


func Login(c *gin.Context) {
	// 获取get方式参数
	// username := c.Param("username")
	username := c.Query("username")
	// 获取post方式参数
	// username := c.PostForm("username")
	// 获取header参数
	// c.Request.Header.Get("username")

	da := user.User{}

	user.GetUser(db.Db, &da, "12")

	fmt.Println(da)

	data := make(map[string]interface{}, 0)

	data["username"] = username

	c.JSON(http.StatusOK, gin.H{
		"message": "success",
		"status":  http.StatusOK,
		"data":    data,
	})
	c.Abort()
	return
}

/*
 * 获取用户信息
 */
func GetUserInfo(c *gin.Context)  {
	c.String(http.StatusOK, "什么垃圾啊")
	return
}

